const path = require("path");
function resolve(dir) {
  return path.join(__dirname, dir);
}
module.exports = {
  // publicPath: process.env.publicPath,
  productionSourceMap: false, //生成的map文件 不生成了
  // chainWebpack: config => { //打包完成之后看大小
  //   config
  //     .plugin('webpack-bundle-analyzer')
  //     .use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin)
  //   config.resolve.alias
  //     .set("@", resolve("src"))
  //     .set("assets", resolve("src/assets"))
  //     .set("api", resolve("src/network/index.js"))
  //   //   .set("components", resolve("src/components"))
  //   //   .set("base", resolve("baseConfig"))
  //   //   .set("public", resolve("public"));
  // },
  devServer: {
    // open: true,
    // host: 'localhost',
    // port: 8080,
    proxy: {
      '/cros/': {
        target: 'http://mobilecdnbj.kugou.com/', //接口域名
        changeOrigin: true,                       //是否跨域
        ws: true,                                 //是否代理 websockets
        secure: true,                             //是否https接口
        pathRewrite: {                            //路径重置
          ['^/cros']: '', //重写接口，去掉/java/mgr-auth
        }
      },
      '/api': {
        target: 'https://neteasecloudmusicapi.vercel.app',//这里后台的地址模拟的;应该填写你们真实的后台接口
        ws: true,
        changOrigin: true,//允许跨域
        secure: true,
        pathRewrite: {
          '^/api': ''//请求的时候使用这个api就可以
        }

      }
    },

    // configureWebpack: {
    //     resolve: {
    //         extensions: [".ts", ".tsx", ".js", ".jsx", ".json"],
    //         alias: {
    //             "@src": "./src/",
    //             "api": "./src/network/requests",
    //             // "@wfc": path.resolve(__dirname, "./src/wfc/"),
    //             // hooks: path.resolve(__dirname, "./src/hooks/"),
    //         },
    //     },
    // }

  }

